package me.w70.bot.scripting;

import java.awt.Graphics;

import me.w70.bot.Bot;
import me.w70.bot.methods.Methods;

public abstract class PassiveScript extends Script implements Runnable {

	public abstract int loop() throws Exception;

	public abstract void draw(Graphics g);

	protected boolean onLoad() {
		return true;
	}

	protected void onEnd() {

	}

	protected void onPause() {

	}

	protected void onResume() {

	}

	public void run() {
		hasRun = true;
		while (true) {
			if (running) {
				startTimer();
				try {
					int w = loop() * 100;
					if (w < 0) {
						running = false;
						return;
					}
					wait(w);

				} catch (Exception e) {
					wait(300);

				}
			}
		}

	}

}
